<?
##########################################################################
#		DOCUMENTATION
##########################################################################
# Class that extends the rootclass. This module will provide the methods
# needed to render the all_categories page.
#
# © LiberLab group, 2011
##########################################################################

require_once("base/baseList.php");

class Renderer extends BaseList{
	public function __construct() {
		parent::__construct("all_categories");
	}
	
	public function main(){
		require_once("dataStructure/category.php");
		$categoryClass = new Category();
		$categories = $categoryClass->getCategoriesNum("books", true, null, $this->limit+1, $this->startId);
		$indMax = min($this->limit, count($categories));
		$this->tagHash["singleCategoryLinkINDEX§§§§singleCategoryINDEX§§§§singleCategoryBooksINDEX"] = $indMax;
		for($index=0; $index<$indMax; $index++){
			$categoryObject = $categories[$index];
			$categoryName = $categoryObject->category;
			$categoryBooks = $categoryObject->books;
			$this->tagHash["singleCategoryLink$index"] = $this->defaultScriptName . "?page=category&amp;id=" . $categoryObject->id;
			$this->tagHash["singleCategory$index"] = ucfirst($categoryName);
			$this->tagHash["singleCategoryBooks$index"] = $categoryBooks;
		}
		$this->prevNext(count($categories));
		
		return $this->render();
	}

	public function __destruct() {
		parent::__destruct();
	}
};

?>
